package com.hc.wego.bean;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
 *
 * @author hc
 * @date 2025-06-17 15:31
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class ResultBean<T> {
    /**
     * 状态码  200成功  400失败
     */
    private Integer code;
    /**
     * 提示信息
     */
    private String msg;
    /**
     * 数据
     */
    private T data;

    public  static  class  ResultBeanUtil{
        public static <T> ResultBean<T> success(Integer code, String msg, T data) {
            return new ResultBean<>(code, msg, data);
        }
        public static <T> ResultBean<T> success(String msg, T data) {
            return new ResultBean<>(200, msg, data);
        }
        public static <T> ResultBean<T> success(T data) {
            return new ResultBean<>(200, "成功！", data);
        }
        public static <T> ResultBean<T> error(Integer code, String msg, T data) {
            return new ResultBean<>(code, msg, data);
        }
        public static <T> ResultBean<T> error(String msg, T data) {
            return new ResultBean<>(400, msg, data);
        }
        public static <T> ResultBean<T> error(T data) {
            return new ResultBean<>(400, "失败！", data);
        }
    }



}
